- title 'Add person to account'
- content_for :head do
  = javascript_include_tag 'sections/users'

- content_for :title do
  %h1= "Add people to the #{truncate(current_account.name, :length => 40)} account"

#new-user
  %p Enter the email address(s) below of the people you would like to add to your account.  Please use a comma to separate each email address if you would like to invite more than one person.

  = form_tag(account_users_path(current_account)) do
    - if flash[:error]
      .form_errors
        = break_html flash[:error]
    %div{:class => (flash[:error] ? 'field_with_errors' : '')}
      = text_area_tag :emails, @emails, :cols => 80, :rows => 6

    .label-spacer

    .input-row
      %b What account permissions do you want to assign to the people you have invited above?
    .input-row
      = radio_button_tag :privileges, Privilege.find(:none)
      = label_tag "privileges_#{Privilege.find(:none)}", 'None, I will assign them permission to access individual backlogs afterwards'
    .input-row
      = radio_button_tag :privileges, Privilege.find(:read)
      = label_tag "privileges_#{Privilege.find(:read)}", 'View all backlogs in this account'
    .input-row
      = radio_button_tag :privileges, Privilege.find(:readstatus)
      = label_tag "privileges_#{Privilege.find(:readstatus)}", 'View all backlogs in this account plus update the status of stories and tasks'
    .input-row
      = radio_button_tag :privileges, Privilege.find(:full)
      = label_tag "privileges_#{Privilege.find(:full)}", 'Full control to view and update all backlogs in this account'

    %br/
    = submit_tag "Send invites"
    = link_to "cancel", account_users_path(current_account)
